package com.aabte.design.pattern.creational.singleton;

public class StaticInnerClassSingleton {

    private StaticInnerClassSingleton(){
        if (InnerClass.instance != null) {
            throw new RuntimeException("单例构造器禁止反射调用！");
        }
    }

    private static class InnerClass{
        private static StaticInnerClassSingleton instance = new StaticInnerClassSingleton();
    }

    public static StaticInnerClassSingleton getInstance(){
        return InnerClass.instance;
    }

}
